<%--
  Created by IntelliJ IDEA.
  User: 22531
  Date: 2021/6/13
  Time: 0:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <link rel="stylesheet" type="text/css" href="/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="/easyui/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="/texteditor/texteditor.css">
    <script type="text/javascript" src="/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/easyui/jquery.easyui.min.js"></script>
    <script src="/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="/texteditor/jquery.texteditor.js"></script>

</head>

<body>
<script type="text/javascript">
    function textCounter(field, countfield, maxlimit) {
        // 函数，3个参数，表单名字，表单域元素名，限制字符；
        if (field.value.length > maxlimit)
            //如果元素区字符数大于最大字符数，按照最大字符数截断；
            field.value = field.value.substring(0, maxlimit);
        else
            //在记数区文本框内显示剩余的字符数；
            countfield.value = maxlimit - field.value.length;
    }
</script>
<div class="easyui-panel" data-options="fit:true,border:false">
    <form id="ff" method="post" action="/admin/saveNews" class="easyui-form" style="width: 100%;height: 100%">

        <div class="easyui-texteditor" title="TextEditor" style="width:100%;height:85%;padding:20px;"name="content" id="te">
        </div>

        <div style="margin-bottom:10px;text-align: center;height: 15%" >
            <input class="easyui-textbox" name="title" style="width:40%" data-options="prompt:'文章标题',required:true">
            <input type="submit" value="发布" class="easyui-linkbutton" onclick="join()" style="width:80px;height:30px">
        </div>

     <%--   <div style="margin-bottom:10px;text-align: center" >
            <textarea name="content" style="font-size:19px;height: 70%;width: 50%;" wrap="hard" cols="30" rows="20"
                      onKeyDown="textCounter(content,remLen,3000);" onKeyUp="textCounter(content ,remLen,3000);"></textarea>
        </div>

        <div style="margin-bottom: 10px;text-align: center">
            您还可以输入:<input name="remLen" type="text" value="3000" size="5" readonly="readonly">个字符
        </div>--%>

    </form>

</div>
<script type="text/javascript">
    function join() {
        $('#ff').form({
            success:function(data){
                if(data.msg==false){
                    alert("发布失败"+data.error)
                }else {
                    alert("发布成功");
                }
            }
        });
    }
</script>
</body>
</html>
